package com.lg.partition41;

import java.io.*;
import java.util.Arrays;

/**
 * @author `RKC`
 * @date 2022/4/12 9:06
 */
public class P4047JSOI2010_部落划分 {

    private static final int N = 1010;
    private static int[][] pairs = new int[N][2];
    private static int[] parent = new int[N];
    private static Edge[] edges = new Edge[N * N];
    private static int n, m, tot = 0;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String[] ss = reader.readLine().split(" ");
        n = Integer.parseInt(ss[0]);
        m = Integer.parseInt(ss[1]);
        for (int i = 0; i < n; i++) {
            ss = reader.readLine().split(" ");
            int a = Integer.parseInt(ss[0]), b = Integer.parseInt(ss[1]);
            pairs[i] = new int[]{a, b};
        }
        //建边然后做一遍kruskal
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                int[] p1 = pairs[i], p2 = pairs[j];
                edges[tot++] = new Edge(i, j, get(p1[0], p1[1], p2[0], p2[1]));
            }
        }
        writer.write(String.format("%.2f\n", kruskal()));
        writer.flush();
    }

    private static double kruskal() {
        for (int i = 1; i <= n; i++) parent[i] = i;
        Arrays.sort(edges, 0, tot);
        int block = n, t = 0;
        for (int i = 0; i < tot; i++) {
            int u = edges[i].u, v = edges[i].v, p1 = find(u), p2 = find(v);
            if (p1 != p2) {
                parent[p1] = p2;
                block--;
                t = i;
                if (block == m) break;
            }
        }
        //找到下一个没有连通的边
        for (int i = t + 1; i < tot; i++) {
            int u = edges[i].u, v = edges[i].v, p1 = find(u), p2 = find(v);
            if (p1 == p2) continue;
            return edges[i].w;
        }
        return 0;
    }

    private static double get(int x1, int y1, int x2, int y2) {
        double a = Math.abs(x2 - x1), b = Math.abs(y2 - y1);
        return Math.sqrt(a * a + b * b);
    }

    private static int find(int x) {
        if (x != parent[x]) parent[x] = find(parent[x]);
        return parent[x];
    }

    private static class Edge implements Comparable<Edge> {
        private int u, v;
        private double w;

        public Edge(int u, int v, double w) {
            this.u = u;
            this.v = v;
            this.w = w;
        }

        @Override
        public int compareTo(Edge o) {
            return Double.compare(w, o.w);
        }
    }
}
